﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CommonHelper
{
    public static class RandomSortHelper
    {
        /// <summary>
        /// 随机排序
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="array">需要排序的数组</param>
        /// <returns></returns>
        public static IEnumerable<T> RandomSort<T>(IEnumerable<T> array, int iteration = 1)
        {
            for (int i = 0; i < iteration; i++)
            {
                array = array.OrderBy(c => Guid.NewGuid());
            }
            return array;
        }
    }
}
